home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_14_inf_rotatesophia.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  142 lines

  1. # Jones 3D Cog Script
  2. #
  3. # 14_INF_RotateSophia.cog
  4. #
  5. # Rotate Sophia inside the cage
  6. #
  7. # [HB]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ==============================================================================
  12.  
  13. symbols
  14.  
  15. # .................................. MESSAGES ..................................
  16.  
  17.     
  18.     message     startup
  19.     message        user0
  20.     message        user1
  21.     
  22. # ................................. KEYFRAMES ..................................
  23.  
  24.     keyframe    so_wobble=0so_spin.key                    local
  25.  
  26. # ................................ ACTOR THINGS ................................
  27.  
  28.     thing        sophia                                    nolink
  29.  
  30. # ............................... OBJECT THINGS ................................
  31.  
  32.     thing        spin_tgt_1                                nolink
  33.     thing        spin_tgt_2                                nolink
  34.     thing        spin_tgt_3                                nolink
  35.  
  36. # ............................... VARIABLES ....................................
  37.     
  38.     vector        v_spos                                    local
  39.     vector        v_tpos                                    local
  40.     vector        v_aim                                    local
  41.  
  42.     flex        f_X                                        local
  43.     flex        f_Y                                        local
  44.  
  45.     int            shespins=0                                local
  46.     
  47. end
  48.  
  49. # ==============================================================================
  50.  
  51. code
  52.  
  53. # NOTE ON COG BEHAVIOR:
  54. # User1 starts Sophia spinning
  55. #
  56. # User0 zeroes our heroine
  57. #
  58. # All spinning is clockwise viewed from above,
  59. # moving sophia's look to ghost targets spaced 120 degrees apart
  60.  
  61. # ..............................................................................
  62.  
  63. startup:
  64.  
  65.     SetCollideType(sophia, 0);
  66.     
  67. return;
  68.  
  69. # ..............................................................................
  70.  
  71. user0:
  72.  
  73.     SetCollideType(sophia, 0);
  74.     shespins = 0;
  75.     
  76.     # Get rid of Sophia...
  77.     ThingFadeAnim(sophia, 1.0, 0.0, 0.5, 0);
  78.     Sleep(0.5);
  79.     ResetThing(sophia);
  80.     DestroyThing(sophia);
  81.  
  82.     Print("sophia gone");
  83.  
  84.     return;
  85.  
  86. # ..............................................................................
  87.  
  88. user1:
  89.     
  90.     SetCollideType(sophia, 0);
  91.     shespins = 1;
  92.     
  93.     # Aim Sophia...
  94.     v_tpos = GetThingPos(spin_tgt_3);
  95.     v_spos = GetThingPos(sophia);
  96.     v_aim = VectorNorm(VectorSub(v_tpos, v_spos));
  97.     f_X = VectorX(v_aim);
  98.     f_Y = VectorY(v_aim);
  99.     v_aim = VectorSet(f_X, f_Y, 0.0); # remove Z        
  100.     SetThingLook(sophia, v_aim);
  101.  
  102.     # Prevent looking up and down...
  103.     SetThingMaxHeadPitch(sophia, 0.0);
  104.     SetThingMinHeadPitch(sophia, 0.0);
  105.     
  106.     # Rotate at magic rate...
  107.     SetThingMaxHeadVel(sophia, 36.0); # no head jerks to next mark
  108.     SetThingMaxRotVel(sophia, 36.0); # 12 secs to spin 360
  109.  
  110.     # Play swim anim...
  111.     PlayKey(sophia, so_wobble, 6, 0x10, 0);
  112.     
  113.     while (shespins != 0)
  114.     {
  115.         AISetLookThingEyeLevel(sophia, spin_tgt_1);
  116.         if (shespins != 0)
  117.         {
  118.             AIWaitForStop(sophia);
  119.         }
  120.         if (shespins != 0)
  121.         {
  122.             AISetLookThingEyeLevel(sophia, spin_tgt_2);
  123.         }
  124.         if (shespins != 0)
  125.         {
  126.             AIWaitForStop(sophia);
  127.         }
  128.         if (shespins != 0)
  129.         {
  130.             AISetLookThingEyeLevel(sophia, spin_tgt_3);
  131.         }
  132.         if (shespins != 0)
  133.         {
  134.             AIWaitForStop(sophia);
  135.         }
  136.     }
  137.  
  138.     return;
  139.  
  140. end
  141.